package com.innerchic.sponsor.builder;

import com.innerchic.sponsor.other.ThreadPoolNorm;
import com.innerchic.sponsor.poster.MainPoster;
import com.innerchic.sponsor.poster.MyLooperPoster;
import com.innerchic.sponsor.poster.Poster;

/**
 * 默认构建器
 */
public class DefaultSponsorBuilder extends SponsorBuilder {

    private ThreadPool threadPool;

    private static final int DEFAULT_POOL_SIZE = 100;

    @Override
    public Poster getMainPoster() {
        return new MainPoster();
    }

    @Override
    public Poster getMyLooperPoster() {
        return new MyLooperPoster();
    }

    @Override
    public ThreadPoolNorm getThreadPool() {
        if (threadPool == null) {
            synchronized (this) {
                threadPool = new ThreadPool(DEFAULT_POOL_SIZE, DEFAULT_POOL_SIZE);
            }
        }
        return threadPool;
    }

}
